
function setActiveTab(tabviewid,tabid,tabs) {
	   for (var i=0; i<tabs.length; i++) {	
			  document.getElementById(tabs[i]).className = "tabOff";
	   		document.getElementById(tabs[i]+'layer').style.display = "none";
	      }
	      
	   document.getElementById(tabid).className = "tabOn";
	   document.getElementById(tabid+'layer').style.display = "block";
	   document.getElementById(tabviewid + '_activetab').value = tabid;

	   // show first tinymce toolbar
	   jQuery(".tinymceMenuBar").hide();
	   jQuery("#" + tabid + "layer .tinymceMenuBar:first").show();
}

/*
 function setActiveTab(tabviewid,tabid,tabs) {
	   for (var i=0; i<tabs.length; i++) {	
           if(	tabid != tabs[i]) {
			    document.getElementById(tabs[i]).className = "tabOff";
	   		  //document.getElementById(tabs[i]+'layer').style.display = "none";
	   		  document.getElementById(tabs[i]+'layer').style.visibility = "hidden";
	   			document.getElementById(tabs[i]+'layer').style.height = "0px";
	   			document.getElementById(tabs[i]+'layer').style.width = "0px";
	   			document.getElementById(tabs[i]+'layer').style.display = "none";
	   			document.getElementById(tabs[i]+'layer').style.overflow = "hidden";
	   			document.getElementById(tabs[i]+'layer').style.zindex = "1";
	   		}
	   }

	   document.getElementById(tabid).className = "tabOn";
	   document.getElementById(tabid+'layer').style.visibility = "visible";
	   document.getElementById(tabid+'layer').style.height = "";
	   document.getElementById(tabid+'layer').style.width = "";
	   document.getElementById(tabid+'layer').style.display = "block";
	   document.getElementById(tabid+'layer').style.overflow = "visible";
	   document.getElementById(tabid+'layer').style.zindex = "666";
	   document.getElementById(tabid+'layer').style.position = "";
	   document.getElementById(tabid+'layer').style.bottom = "";
	   document.getElementById(tabviewid+'_activetab').value=tabid;
}
*/




function resizeTabView(TabPageArr, TabViewName) {
	var clientHeight = self.innerHeight;
	var clientWidth = self.innerWidth;
	
	if (clientHeight == null) {
		clientHeight =(document.compatMode=="CSS1Compat")?document.documentElement.clientHeight : document.body.clientHeight;
		clientWidth = document.body.clientWidth;
		}
		
	resizeTabViewTo(TabPageArr, TabViewName, clientHeight, clientWidth)
}

function resizeTabViewTo(TabPageArr, TabViewName, tvHeight, tvWidth) {
	
	var tabviewHeight = tvHeight - 12;
		
	document.getElementById(TabViewName).style.width = tvWidth + "px";
	document.getElementById(TabViewName).style.height =  tabviewHeight + "px";
	
				
		for (i=0;i<TabPageArr.length;i++) {
			scrollwidth = tvWidth - 30;
			//document.getElementById(TabPageArr[i] +"layer").style.height = (tvHeight-25) + "px";
			document.getElementById(TabPageArr[i] +"layer_contentlayer").style.height = (tabviewHeight - 67) + "px";
			//document.getElementById(TabPageArr[i] +"layer_contentlayer").style.border = "2px solid #fff";
			
			document.getElementById(TabPageArr[i] +"layer_contentlayer").style.width = (tvWidth - 2) + "px";
			document.getElementById(TabPageArr[i] +"layer_menu").style.width = (scrollwidth) + "px";
			document.getElementById(TabPageArr[i] +"layer_menu_slh").style.width = (scrollwidth) + "px";
		}
}

function tabSwitch(direction) {
	var preFix = 'TabView1';
	var currentTab = document.getElementById(preFix+'_activetab').value;
	currentTab = currentTab.substr(preFix.length+4,currentTab.length-preFix.length-4);
	var nextTab = Math.round(currentTab)+direction;
	if (nextTab < 10)
		nextTab = "0" + nextTab;
	
	// Try to grab the next one!
	if (nextTab != "00") {
		if (document.getElementById(preFix+'_tab' + nextTab) != null) {
			setActiveTab(preFix,preFix + '_tab' + nextTab,eval(preFix+'_tabs'));
		}
	}
}